<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>

		</style>
	</head>
	<body>
		<button onclick="math('+')"> + </button>
		<p></p>
		<button onclick="math('-')"> - </button>

		<br />
		<button onclick="numObj.addj()"> + </button>
		<span></span>
		<button onclick="numObj.delj()"> - </button>
		<script type="text/javascript">
			function b1(num) {
				document.querySelector('p').textContent = num

				return function(or) {
					let n = or == '+' ? ++num : --num
					document.querySelector('p').textContent = n
				}
			}
			var math = b1(0)


			function n1(numj) {

				function addj() {
					numj++
					numjChange()
				}

				function delj() {
					numj--
					numjChange()
				}

				function numjChange() {
					document.querySelector('span').innerText = numj
				}

				numjChange()
				return {
					addj,
					delj
				}
			}
			const numObj = n1(10)
		</script>
	</body>
</html>